<template>
  <div>
    <h2>child2</h2>
    <div>
      <el-button type="primary" @click="sendMsg">发送消息给父</el-button>
      <el-button type="primary" @click="sendMsgToBrother">发送消息给哥哥</el-button>
    </div>
  </div>
</template>
<script setup lang="ts">
import emitter from '@utils/emitter.ts'

const msg2 = ref('msg——2')

const sendMsg = () => {
  emitter.emit('child2Msg', msg2)
}

const sendMsgToBrother = () => {
  msg2.value += '~'
  emitter.emit('sendMsgToBrother', msg2)
}
</script>
<style scoped></style>
